package app.models;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity
@Table(name = "TEMPLATE_BIOMETRIA")
public class BiometriaTemplate implements Pojo{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8462452620110510644L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	private Long id;
	
	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@JoinColumn(name = "ID_PACIENTE", referencedColumnName = "ID", insertable = false, updatable = false)
	private Paciente paciente;
	
	@Column(name = "ID_PACIENTE", columnDefinition = "integer")
	private Integer idPaciente;
	
	@NotNull(message = "O dedo deve ser preenchido")
	@Column(name = "DEDO", columnDefinition = "varchar(50)")
	private String dedo;
	
	@NotNull(message = "O template deve ser preenchido")
	@Column(name = "TEMPLATE", columnDefinition = "blob")
	private byte[] template;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Paciente getPaciente() {
		return paciente;
	}

	public void setPaciente(Paciente paciente) {
		this.paciente = paciente;
	}

	public Integer getIdPaciente() {
		return idPaciente;
	}

	public void setIdPaciente(Integer idPaciente) {
		this.idPaciente = idPaciente;
	}

	public String getDedo() {
		return dedo;
	}

	public void setDedo(String dedo) {
		this.dedo = dedo;
	}

	public byte[] getTemplate() {
		return template;
	}

	public void setTemplate(byte[] template) {
		this.template = template;
	}
	
}
